<template>
	<view class="history-section">
		<view class="history-list"  v-for="(item,index) in Historylist" :key="index"
		 @click="navTo('/pages/product/product?id='+item.goodsid)">
			<image :src="item.thumb" mode=""></image>
			<view class="list-title">
				<view class="clamp2">{{item.title}}</view>
				<view>￥{{item.saleprice}}</view>
			</view>
		</view>
		<view class="empty_loading">
			<image v-show="isloading" src="/static/business/loading.gif" mode=""></image>
			<text v-show="isempty">没有更多了~</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				Historylist: [],
				scroll: 0,
				Stop: 0,
				Wbott:false,
				height: uni.getSystemInfoSync().windowHeight,
				page: 0,
				isempty: false,
				isloading: false,
			}
		},
		onLoad() {
			this.getList();
		},
		onReachBottom() {
			this.getList();
		},
		methods: {
			getList(){
				var that = this;
				that.isloading = true;
				that.isempty = false;
				that.page++;
				that.$axios('history/display', "POST", 'shop', {
					page: that.page
				}).then(res => {
					this.isloading = false;
					if (res.data.code == 200) {
						let data = res.data.data.list;
						// let data = res.data.data.list.filter(item=>item.thumb!==null);
						that.Historylist = [...that.Historylist, ...data]
						this.isempty = data.length <= 0;
					}
				}, (error) => {
				
				})
			},
			// 页面跳转
			navTo(url) {
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		color: #303133;
		font-size: 32rpx;
		padding-bottom: 100rpx;
	}

	.history-section {
		background-color: #f2f2f2;
		position: relative;
		overflow: hidden;
	}

	.history-list {
		background-color: #fff;
		display: flex;
		justify-content: center;
		align-items: center;
		padding: 20upx;
		margin-bottom: 20upx;
	}

	.history-list image {
		width: 160upx;
		height: 160upx;
		margin-right: 30upx;
		border-radius: 15rpx;
	}

	.list-title {
		flex: 1;
	}

	.list-title view:nth-of-type(1) {
		line-height: 45upx;
		height: 90upx;
	}

	.list-title view:nth-of-type(2) {
		color: $base-color;
		font-size: 36upx;
		padding-top: 14upx;
		text-align: right;
		padding-right: 40upx;
	}
	.bott-di{
		color: #0062CC;
		font-size: 30upx;
		line-height: 80upx;
		text-align: center;
		padding-bottom: 20upx;
	}
</style>
